﻿using System;
using System.Threading;

namespace Borg
{
    public sealed class DefaultInvoker : IInvoker
    {
        public event InvokerUnexpectedExceptionEventHandler UnexpectedException
        {
            add { }
            remove { }
        }

        public object Invoke(Delegate @delegate, params object[] @params)
        {
            return @delegate.DynamicInvoke(@params);
        }

        public bool CheckAccess(Dispatcher dispatcher)
        {
            return dispatcher.IsWorker(Thread.CurrentThread);
        }

        public void Dispose()
        { }
    }
}
